package cn.hsa.fqz.task.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.hsa.fqz.task.entity.RegionDO;
import cn.hsa.fqz.task.service.RegionService;
import cn.hsa.fqz.task.dao.RegionMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class RegionServiceImpl extends ServiceImpl<RegionMapper, RegionDO>
    implements RegionService{

    @Override
    public List<RegionDO> getRegions(String... regions) {

        LambdaQueryWrapper<RegionDO> lambdaQueryWrapper
                 = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(RegionDO::getRegion,regions);

        return this.list(lambdaQueryWrapper);
    }

    @Override
    public List<RegionDO> getRegionsBypRegion(String pRegion) {
        LambdaQueryWrapper<RegionDO> lambdaQueryWrapper
                = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(RegionDO::getpRegion,pRegion);

        return this.list(lambdaQueryWrapper);
    }

    @Override
    public List<RegionDO> getAllCitys() {
        LambdaQueryWrapper<RegionDO> lambdaQueryWrapper
                = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(RegionDO::getDistrinct,"").ne(RegionDO::getpRegion,"999");
        return this.list(lambdaQueryWrapper);
    }
}




